package edu.udo.sopra10.chaturaji.gui;
import java.awt.event.ActionEvent;
import javax.swing.AbstractAction;
import javax.swing.ButtonGroup;
import javax.swing.JButton;
import javax.swing.JEditorPane;
import javax.swing.JRadioButton;
import javax.swing.JScrollPane;
import javax.swing.JTable;

import javax.swing.WindowConstants;
import javax.swing.table.DefaultTableModel;
import javax.swing.table.TableModel;
import javax.swing.SwingUtilities;


/**
* This code was edited or generated using CloudGarden's Jigloo
* SWT/Swing GUI Builder, which is free for non-commercial
* use. If Jigloo is being used commercially (ie, by a corporation,
* company or business for any purpose whatever) then you
* should purchase a license for each developer using Jigloo.
* Please visit www.cloudgarden.com for details.
* Use of Jigloo implies acceptance of these licensing terms.
* A COMMERCIAL LICENSE HAS NOT BEEN PURCHASED FOR
* THIS MACHINE, SO JIGLOO OR THIS CODE CANNOT BE USED
* LEGALLY FOR ANY CORPORATE OR COMMERCIAL PURPOSE.
*/
public class HighscoreFrame extends javax.swing.JFrame {
	private JRadioButton RoundButton;
	private AbstractAction closeAboutAction;
	private JButton OkButton;
	private JRadioButton ThreeElimButton;
	private JRadioButton OneElimButton;
	private JRadioButton PointsButton;
	private JTable PlayerTable;
	private ButtonGroup buttonGroup;

	/**
	* Auto-generated main method to display this JFrame
	*/
	public static void main(String[] args) {
		SwingUtilities.invokeLater(new Runnable() {
			public void run() {
				HighscoreFrame inst = new HighscoreFrame();
				inst.setLocationRelativeTo(null);
				inst.setVisible(true);
			}
		});
	}
	
	public HighscoreFrame() {
		super();
		initGUI();
		
		// option group
		buttonGroup = new ButtonGroup();
		buttonGroup.add( RoundButton );
		buttonGroup.add( PointsButton );
		buttonGroup.add( OneElimButton );
		buttonGroup.add( ThreeElimButton );
		
	}
	
	private void initGUI() {
		try {
			this.setResizable(false);
			this.setTitle("Highscore");
			setDefaultCloseOperation(WindowConstants.DISPOSE_ON_CLOSE);
			getContentPane().setLayout(null);
			//getContentPane().setBackground(new java.awt.Color(192,192,192));
			{
				TableModel PlayerTableModel = 
					new DefaultTableModel(
							new String[][] { { "  PLATZIERUNG", "    VORNAME","    NACHNAME", "      PUNKTE"}, { "", "" } },
							new String[] { "Column 1", "Column 2" , "Column 3", "Column 4" });
				((DefaultTableModel) PlayerTableModel).setColumnCount(4);
				((DefaultTableModel) PlayerTableModel).setRowCount(13);
				PlayerTable = new JTable();
				getContentPane().add(PlayerTable);
				PlayerTable.setModel(PlayerTableModel);
				PlayerTable.setBounds(30, 60, 502, 208);
				//PlayerTable.setBackground(new java.awt.Color(255,255,255));
				PlayerTable.setFont(new java.awt.Font("Berlin Sans FB",3,12));
				PlayerTable.setCellSelectionEnabled(true);
				PlayerTable.setEnabled(false);

			}
			{
				RoundButton = new JRadioButton();
				getContentPane().add(RoundButton);
				RoundButton.setText("Runden");
				RoundButton.setBounds(17, 20, 129, 19);
			}
			{
				PointsButton = new JRadioButton();
				getContentPane().add(PointsButton);
				PointsButton.setText("Punkte");
				PointsButton.setBounds(146, 20, 135, 19);
			}
			{
				OneElimButton = new JRadioButton();
				getContentPane().add(OneElimButton);
				OneElimButton.setText("1 besiegt");
				OneElimButton.setBounds(281, 20, 134, 19);
			}
			{
				ThreeElimButton = new JRadioButton();
				getContentPane().add(ThreeElimButton);
				ThreeElimButton.setText("3 besiegt");
				ThreeElimButton.setBounds(415, 20, 128, 19);
			}
			{
				OkButton = new JButton();
				getContentPane().add(OkButton);
				OkButton.setText("Ok");
				OkButton.setBounds(245, 280, 71, 21);
				OkButton.setAction(getCloseAboutAction());

			}
			pack();
			this.setSize(573, 351);
			
		} catch (Exception e) {
		    //add your error handling code here
			e.printStackTrace();
		}
	}
	
	private AbstractAction getCloseAboutAction() {
		if(closeAboutAction == null) {
			closeAboutAction = new AbstractAction("OK", null) {
				public void actionPerformed(ActionEvent evt) {
					dispose();
				}
			};
		}
		return closeAboutAction;
	}

}
